/*
 * @(#)PersistableModelType.java
 * Date 2013-09-04
 * Version 1.0
 * Author Jim Horner
 * Copyright (c)2012
 */


package us.hornerscorners.lamppost.model.common;

import us.hornerscorners.lamppost.model.audit.AuditEvent;
import us.hornerscorners.lamppost.model.document.DocumentContent;
import us.hornerscorners.lamppost.model.document.DocumentEntry;
import us.hornerscorners.lamppost.model.document.Folder;
import us.hornerscorners.lamppost.model.document.SubmissionSet;

import us.hornerscorners.lamppost.model.patient.Patient;
import us.hornerscorners.lamppost.model.patient.PatientIdentity;


/**
 * Enum description
 *
 */
public enum PersistableModelType {

    AuditEvent(AuditEvent.class),
    DocumentContent(DocumentContent.class), 
    DocumentEntry(DocumentEntry.class),
    Folder(Folder.class), 
    Patient(Patient.class),
    PatientIdentity(PatientIdentity.class), 
    SubmissionSet(SubmissionSet.class);

    /** Field description */
    private final Class modelClass;

    /**
     * Constructs ...
     *
     *
     * @param c
     */
    private PersistableModelType(Class c) {
        this.modelClass = c;
    }

    /**
     * Method description
     *
     *
     * @param clazz
     *
     * @return
     */
    public static PersistableModelType toPersistableModelType(Class clazz) {

        PersistableModelType result = null;

        for (PersistableModelType type : values()) {

            if (type.modelClass.equals(clazz)) {

                result = type;

                break;
            }
        }

        return result;
    }

    /**
     * Method description
     *
     *
     * @return
     */
    public Class getPersistableClass() {
        return this.modelClass;
    }
}
